﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CMS.BLL;

public partial class news_ImageManage_Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
            int page = 1;
            if (!int.TryParse(Request["Page"], out page))
            {
                page = 1;
            }
            bd(page);
        }
    }

    void bd(int page)
    {
        ImageManageBLL imageManageBLL = new ImageManageBLL();
        int count = 0;
        int pageSize = 20;
        var lst = imageManageBLL.GetLst(page, pageSize, out count);
        rep1.DataSource = lst;
        rep1.DataBind();
        AspNetPager1.RecordCount = count;
        AspNetPager1.PageSize = pageSize;
        AspNetPager1.CurrentPageIndex = page;
    }
    protected void btnQuery_Click(object sender, EventArgs e)
    {
        string title = txtTitle.Text;
        if (string.IsNullOrEmpty(title))
        {
            bd(1);
        }
        else
        {
            ImageManageBLL imageManageBLL = new ImageManageBLL();
            var lst = imageManageBLL.GetLst(txtTitle.Text);
            rep1.DataSource = lst;
            rep1.DataBind();
            AspNetPager1.RecordCount = 0;
        }
    }
}